package usf.gwt.ui.bootstrap.client;

import usf.gwt.ui.bootstrap.client.core.JqueryUtils;

import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.DOM;

public class IconButton extends Button {

	@Override
	protected Element initWidget() {
		Element e = super.initWidget();
		e.insertFirst(DOM.createSpan());
 		return e;
	}
	@Override
	protected void initStyle() {
		super.initStyle();
		getIconElement().addClassName(IconTypes.ICONE_STYLE);
	}
	
	protected Element getIconElement(){
		return getElement().getFirstChildElement();
	}
	public void setIcon(IconTypes type) {
		JqueryUtils.switchClass(getIconElement(), IconTypes.values(), type);
	}
}
